<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="com.puneMovies.data.Theater" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script>
function closePopup()
{

 <%if(request.getAttribute("closeWindow")!=null){%>
 var parentWin=window.opener;   
 parentWin.document.location.reload();
 window.close();
 <%}%>
}
function addTheater()
{

 document.forms[0].actionRequest.value='addTheater';
 document.forms[0].theaterAddress.value= document.forms[0].theaterAddressTA.value;
 document.forms[0].submit();
}
function modifyTheater()
{

 document.forms[0].action='modifyTheater.do';
 document.forms[0].actionRequest.value='modifyTheater';
 document.forms[0].theaterAddress.value= document.forms[0].theaterAddressTA.value;
 document.forms[0].submit();


}
</script>
</head>

<c:set var="theater" value="${requestScope.Theater_For_Modify}" />
<body onLoad="closePopup()" >
<form name="f1" action="addTheater.do">
<table width="100%" border="0">
  <tr>
    <td width="29%">TheaterName</td>
    <td width="71%"><input type="text" name="theaterName"  value="<c:out value="${theater.theaterName}" />" /></td>
  </tr>
  <tr>
    <td>City</td>
    <td><input type="text" name="theaterCity" value="<c:out value="${theater.city}" />" /></td>
  </tr>
  <tr>
    <td>State</td>
    <td><input type="text" name="theaterState" value="<c:out value="${theater.state}" />" /></td>
  </tr>
  <tr>
    <td>Country</td>
    <td><input type="text" name="theaterCountry" value="<c:out value="${theater.country}" />" /></td>
  </tr>
  <tr>
    <td height="52">Address</td>
    <td><textarea  name="theaterAddressTA"><c:out value="${theater.address}" /></textarea></td>
  </tr>
  <tr>
    <td colspan="2"><div align="center">
    <c:choose>
     <c:when test="${empty theater}" >
      <input type="button" name="Submit" value="Submit"  onClick="addTheater()"/>
     </c:when>
     <c:otherwise>
      <input type="button" name="Submit" value="Submit"  onClick="modifyTheater()"/>
      <input type="hidden" name="theaterId" value="${requestScope.theaterId}" />
     </c:otherwise>     
     </c:choose>
      <input type="hidden" name="actionRequest">
      <input type="hidden" name="theaterAddress" >
      <input type="button" name="Submit2" value="Cancel" />
    </div></td>
  </tr>
</table>
</form>
</body>
</html>
